﻿using System;

namespace MugenInjection.Delegates
{
    /// <summary>
    ///     Represents the delegate to create an object.
    /// </summary>
    /// <param name="parameters">The specified parameters.</param>
    /// <returns>An instance of object.</returns>
    public delegate object ActivatorDelegate(params object[] parameters);

    /// <summary>
    ///    Represents the delegate to assign an object value for the value <see cref="Type" />.
    /// </summary>
    /// <typeparam name="TTarget">Type of the target.</typeparam>
    /// <param name="target">The object whose value will be set.</param>
    /// <param name="value">The value to assign to the field.</param>
    public delegate void SetterValueTypeDelegate<TTarget>(ref TTarget target, object value);

    /// <summary>
    ///     Represents the delegate to assign an object value.
    /// </summary>
    /// <typeparam name="TTarget">Type of the target.</typeparam>
    /// <param name="target">The object whose value will be set.</param>
    /// <param name="value">The value to assign to the field.</param>
    public delegate void SetterDelegate<in TTarget>(TTarget target, object value) where TTarget : class;

    /// <summary>
    ///     Represents the delegate to get an object value.
    /// </summary>
    /// <typeparam name="TTarget">Type of the target.</typeparam>
    /// <typeparam name="T">Type of result object.</typeparam>
    /// <param name="target">The object whose field value will be returned.</param>
    /// <returns>An object containing the value of the member reflected by this instance.</returns>
    public delegate T GetterDelegate<in TTarget, out T>(TTarget target);

    /// <summary>
    ///     Represents the delegate to invokes the method using the specified parameters.
    /// </summary>
    /// <param name="target">The object on which to invoke the method. If a method is static, this argument is ignored.</param>
    /// <param name="parameters">An argument list for the invoked method. This is an array of objects with the same number, order, and type as the parameters of the method to be invoked.</param>
    /// <returns></returns>
    public delegate object InvokeMethodDelegate<in TTarget>(TTarget target, params object[] parameters) where TTarget : class;

    /// <summary>
    ///     Represents the delegate to invokes the method using the specified parameters for the value <see cref="Type" />.
    /// </summary>
    /// <param name="target">The object on which to invoke the method. If a method is static, this argument is ignored.</param>
    /// <param name="parameters">An argument list for the invoked method. This is an array of objects with the same number, order, and type as the parameters of the method to be invoked.</param>
    /// <returns></returns>
    public delegate object InvokeMethodValueTypeDelegate<TTarget>(ref TTarget target, params object[] parameters);
}